<?php
include_once "ImageComponent.php";
include_once "DivTag.php";
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ImageDivComponent
 *
 * @author Jhonny
 */
class ImageDivComponent extends DivTag {

    private $img;
    public function __construct() {
        $this->img = new ImageComponent();
    }
    public function setSource($source){
        $this->img->setSource($source);
    }
    public function getSource(){
        return $this->img->getSource();
    }
    public function getAlt() {
        return $this->img->getAlt();
    }

    public function setAlt($alt) {
        $this->img->setAlt($alt);
    }

    public function toString() {
        $value='';
        if($this->getSource()!=null){

            $value.='<div ';
            if($this->getClass()!=null){
                $value.='class="'.$this->getClass().'"';
            }else if($this->getId ()!=null){
                $value.='id="'.$this->getId().'"';
            }
            $value.='>
                ';
            $value.=$this->img->toString();
            $value.='</div>
    ';
        }
        return $value;
    }
}
?>
